package com.iking.housekeeping.dao.elderly;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.github.pagehelper.Page;
import com.iking.housekeeping.entity.elderly.Elderly;
import com.iking.housekeeping.httpbean.elderlyrelation.HttpElderlyRelation;
import com.iking.housekeeping.httpbean.elderlyreq.ElderlySelectReq;
import com.iking.housekeeping.httpbean.elderlyreq.HttpElderlyReq;
import com.iking.housekeeping.httpbean.elderlyres.ElderlyRes;
import com.iking.housekeeping.httpbean.elderlyres.HttpElderlyRes;
import com.iking.housekeeping.httpbean.list.Gender;
import com.iking.housekeeping.httpbean.servicestaff.reqbean.HttpGiveElderly;

/**
 * 老人管理
 * 
 * @author: gf
 * @date: 2018年4月18日 下午1:49:51
 */
@Mapper
public interface ElderlyMapper {
	
	/**
	 * 根据id删除老人信息
	 * @param fId
	 * @return
	 */
    int deleteByPrimaryKey(String fId);
    
    /**
     * 添加老人信息
     * @param record
     * @return
     */
    int insert(Elderly record);
    
    /**
     * 添加老人信息
     * @param record
     * @return
     */
    int insertSelective(Elderly record);
    
    /**
     * 查看老人信息
     * @param fId
     * @return
     */
    Elderly selectByPrimaryKey(String fId);

	/**
	 * 	通过电话查询老人
	 *  @return Elderly 老人对象
	 *  @author gf
	 */
	Elderly selectByPhone(String fPhone);
    
    /**
     * 更新老人信息
     * @param record
     * @return
     */
    int updateByPrimaryKeySelective(Elderly record);
    
    /**
     * 更新老人信息
     * @param record
     * @return
     */
    int updateByPrimaryKey(Elderly record);
    
    /**
     * 	通过身份证查询
     *  @param fCardId
     *  @return int
     *  @author gf
     */
    Elderly selectByCardId(String fCardId);

    /**
     * 	删除老人信息
     *  @param fId
     *  @return Integer
     *  @author gf
     */
	int updateByFidPrimaryKey(String fId);
	
	/**
	 * 	批量删除老人
	 *  @param list
	 *  @return int
	 *  @author gf
	 */
	int deleteBatch(@Param("list") List<String> list);
	
	/**
	 * 查询老人信息
	 * @param elderlyPage
	 * @return
	 */
	Page<HttpElderlyRes> selectAll(ElderlySelectReq elderlyPage);
	
	/**
	 * 	老人家属关联信息
	 *  @param fId
	 *  @return ElderlyDetailsRes
	 *  @author gf
	 */
	HttpElderlyReq selectElderlyDetails(String fId);
	/**
	 * 	性别
	 *  @return List<Gender>
	 *  @author gf
	 */
	List<Gender> selectGender();
	/**
	 * 
	 * @Description:查询所方服务的老人信息
	 * @author:CGZ
	 * @param fServiceStaffId
	 * @return
	 */
	List<Elderly> selectByFserviceStaffId(String fServiceStaffId);
	
	 /**
	 * 	通过老人查询家属
	 *  @param fElderly
	 *  @return List<HttpElderlyRelation>
	 *  @author gf
	 */
	List<HttpElderlyRelation> selectRelationByElderly(String fId);

	/**
	 * 秦甫杰
	 * 查询所有预约老人列表
	 * @return
	 */
	List<ElderlyRes> selectAllElderly(String fServiceStsff);
	
	/**
	 * 	批量更新老人的服务人员id
	 *  @param httpGiveElderly
	 *  @return int
	 *  @author gf
	 */
	int updateByStaffId(HttpGiveElderly httpGiveElderly);

	Elderly selectAllElderlys(@Param("fId") String fId);

	/**
	 * 查询某种服务状态下的老人列表
	 * @param fId
	 * @param fState
	 * @return
	 */
	List<String> selectElderlyBySelectList(@Param("fId") List<String> fId,@Param("fState") String fState);

	/**
	 * 查询老人是否被预约
	 * @param fId
	 * @return
	 */
	List<String>  selectElderlyState(@Param("fId") List<String> fId);
	/**
	 * 根据服务人员IDlist查询老人iD列表
	 * @param list
	 * @return
	 */
	List<String> selectByServiceStaffList(List<String> list);

	/**
	 * 查询老人在某时间段的服务信息
	 * @param httpElderlyRes
	 * @return
	 */
	List<HttpElderlyRes> selectInfoByTime(HttpElderlyRes httpElderlyRes);
}